#include "D3d9App.h"

CD3d9App::CD3d9App(void)
{
	m_appObject = 0 ;
	m_md3Object = 0 ;
	m_d3dDevice = 0 ;
}

CD3d9App::~CD3d9App(void)
{
	
	if (m_d3dDevice) m_d3dDevice->Release() ;
	if (m_md3Object) m_md3Object->Release() ;
	if (m_appObject) delete m_appObject ;
}

bool CD3d9App::init(int widith, int height )
{
	m_widith = widith ;
	m_height = height ;

	m_appObject = new CWin32(m_widith,m_height) ;
	m_appObject->init(::GetModuleHandle(0),1 ) ;

	return true ;
}

int CD3d9App::run()
{
	return m_appObject->run() ;
}

int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR lpCmd, int showCmd )
{

	// Enable run-time memory check for debug builds.
	#if defined(DEBUG) | defined(_DEBUG)
		_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
	#endif

	CD3d9App*	demo = new CD3d9App() ;
	
	demo->init(800,600) ;
	
	demo->run()  ; 

	delete demo ;
	return 0 ;
}